package net.animats.music;

import java.util.List;
import java.util.ArrayList;

public class Song  {
	private String name;
	private List<Chord> chords = new ArrayList<Chord>();
	
	public Song (String _name) {
		name = _name;
	}

	public String getChordText() {	
		String output = "";
		for (Chord chord : chords) {
			output += " " + chord.getShortName();
		}

		return output;
	}

	public String toString() {	
		String output = name + ": ";
		for (Chord chord : chords) {
			output += chord.getShortName() + " ";
		}

		return output;
	}

	public void addChord(String _rootNote, String _chordType) {
		Chord chord = new Chord(_rootNote, _chordType);

		if (!chords.contains(chord)) {
			chords.add(chord);
		}
	}

	public int removeLast() {
		int index = chords.size();
		if (index != 0) {
			chords.remove(index - 1);
		}
		return chords.size();
	}

	public void addChord(Chord _chord) {
		if (!chords.contains(_chord)) {
			chords.add(_chord);
		}
	}

	public List<Chord> getChords() {
		return chords;
	}

	public String getName() {
		return name;
	}

}
